/*
 * @author: Archy
 * @Date: 2022-03-17 11:49:54
 * @LastEditors: Archy
 * @LastEditTime: 2022-03-17 14:09:26
 * @FilePath: \arkgen\react\src\shared\utils.ts
 * @description: 
 */

export function deserialize(serializedJavascript: string) {
  console.log(serializedJavascript);
  return eval('(' + serializedJavascript + ')');
}

export const parseDeep = (json: Record<string, any>) => {
  const draft: Record<string, any> = {}
  for (let item in json) {
    if (typeof json[item] === 'object') {
      draft[item] = parseDeep(json[item])
    } else {
      draft[item] = deserialize(json[item])
    }
  }
  return draft
}
